package guigu.IoSystem;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

//用来读取mysql.properties文件
//class Properties extends Hashtable<Object,Object>
public class PropertiesTest1 {
    public static void main(String args[]) throws IOException {
        //1.创建properties对象
        Properties properties = new Properties();
        //2.加载指定配置文件
        properties.load(new FileReader("com.guigu.IO\\mysql.properties"));
        //3.把k-v显示控制台
        properties.list(System.out);
        //4.根据K获取对应的值
        String user = properties.getProperty("user");
        String pwd = properties.getProperty("pwd");
        System.out.println("用户名="+user+"\n"+"密码="+pwd);
    }
}
